Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious "Extracting tar content of undefined failed" #7212

Open
jleclanche opened this issue Apr 20, 2019 · 62 comments
Open

Spurious "Extracting tar content of undefined failed" #7212

jleclanche opened this issue Apr 20, 2019 · 62 comments

Comments

@jleclanche
Copy link

jleclanche commented Apr 20, 2019

Followup on #6312. Potentially related issues: #7087, #6755, #6312

Details

  • yarn --version: 1.15.2
  • yarn.lock
  • command-line: rm ~/.cache/yarn ~/.npm ./node_modules -rf && yarn install --production --frozen-lockfile
  • Arch Linux. Also reproduced on node:latest docker image.

I can still reproduce the issue on the latest yarn version. I do have a git dependency ("@magicfind/wf-build-engine": "https://gitlab.com/magicfind/warframe/wf-build-engine.git") and I'm fairly certain it's related to that, because I've been messing with it, though I don't know what exactly caused this to start happening.
I've been hitting #5235 and trying to work around it, and while doing that started hitting #6312.

Locally I see three different behaviours:

  • I hit the error and yarn aborts
  • I hit the error and yarn continues
  • I do not hit the error and the install succeeds.

This points to a race condition of some type?

Example outputs

All outputs below run the exact same command line, removing all the cache I can find. I've not found a reliable way to reproduce the issue 100% of the time.

yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, chmod '/home/adys/.cache/yarn/v4/npm-require-main-filename-1.0.1-97f717b69d48784f5f526a6c5aa8ffdda055a4d1/node_modules/require-main-filename/LICENSE.txt'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ npm run build
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1555780098541-0.2687961721890739/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] build /home/adys/.cache/yarn/v4/.tmp/83dda1d0ded23f5a9d7b82676a04465a.c67a312e2664e1fa7b0ae1176d36d03b6e40e079.prepare
> rollup -c


src/index.ts → dist/index.js, dist/index.es.js...                                                                                                                                             
created dist/index.js, dist/index.es.js in 1.1s
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "prop-types@^15.6.0".
warning " > [email protected]" has unmet peer dependency "draft-js@^0.10.5".
warning "react-scripts > [email protected]" has incorrect peer dependency "[email protected]".
warning "react-scripts > [email protected]" has incorrect peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.0".
warning " > [email protected]" has unmet peer dependency "remark-parse@>=3.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
Done in 23.64s.
yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, open '/home/adys/.cache/yarn/v4/npm-is-stream-1.1.0-12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44/node_modules/is-stream/package.json'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, chmod '/home/adys/.cache/yarn/v4/npm-iconv-lite-0.4.24-2022b4b25fbddc21d2f524974a474aafe733908b/node_modules/iconv-lite/encodings/utf16.js'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ npm run build
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1555780287695-0.048757454583545856/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] build /home/adys/.cache/yarn/v4/.tmp/83dda1d0ded23f5a9d7b82676a04465a.c67a312e2664e1fa7b0ae1176d36d03b6e40e079.prepare
> rollup -c


src/index.ts → dist/index.js, dist/index.es.js...                                                                                                                                             
created dist/index.js, dist/index.es.js in 1.1s
yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "EEXIST: file already exists, mkdir '/home/adys/.cache/yarn/v4/npm-fast-json-stable-stringify-2.0.0-d5142c0caee6b1189f87d3a76111064f86c8bbf2/node_modules/fast-json-stable-stringify/test'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
@jleclanche
Copy link
Author

jleclanche commented Apr 20, 2019

Weird:

$ yarn cache list

yarn cache v1.15.2
error An unexpected error occurred: "There should only be one folder in a package cache (got  in /home/adys/.cache/yarn/v4/npm-@magicfind-wf-build-engine-0.1.0-c67a312e2664e1fa7b0ae1176d36d03b6e40e079/node_modules/@magicfind)".
info If you think this is a bug, please open a bug report with the information provided in "/home/adys/src/overframe/frontend/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/cache for documentation about this command.
tree ~/.cache/yarn/v4/npm-@magicfind-wf-build-engine-0.1.0-c67a312e2664e1fa7b0ae1176d36d03b6e40e079/
/home/adys/.cache/yarn/v4/npm-@magicfind-wf-build-engine-0.1.0-c67a312e2664e1fa7b0ae1176d36d03b6e40e079/
└── node_modules
    └── @magicfind

2 directories, 0 files

yarn-error.log

Edit: Relevant commit: b1f21a8

@jleclanche
Copy link
Author

jleclanche commented Apr 20, 2019

The undefined showing up in the error message made me wonder if there was another issue at play here but it seems to be a missing parameter which is only used for the error message.

const tarballCachePath = this.getTarballCachePath();
const {validateStream, extractorStream} = this.createExtractor(resolve, reject);

Passing tarballCachePath as a third parameter here will make the error message make more sense:

error https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz: Extracting tar content of "/home/adys/.cache/yarn/v4/npm-glob-7.1.3-3960832d3f1574108342dafd3a67b332c0969df1/node_modules/glob/.yarn-tarball.tgz" failed, the file appears to be corrupt: "ENOENT: no such file or directory, open '/home/adys/.cache/yarn/v4/npm-glob-7.1.3-3960832d3f1574108342dafd3a67b332c0969df1/node_modules/glob/changelog.md'"

It does nothing to actually help the error though.

@jleclanche
Copy link
Author

I ran rm ~/.cache/yarn ~/.npm node_modules yarn.lock && yarn install --verbose, to see if anything else can be gleaned from there:

verbose 13.540595951 Error: https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz: Extracting tar content of "/home/adys/.cache/yarn/v4/npm-fast-json-stable-stringify-2.0.0-d5142c0caee6b1189f87d3a76111064f86c8bbf2/node_modules/fast-json-stable-stringify/.yarn-tarball.tgz" failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/home/adys/.cache/yarn/v4/npm-fast-json-stable-stringify-2.0.0-d5142c0caee6b1189f87d3a76111064f86c8bbf2/node_modules/fast-json-stable-stringify/test/to-json.js'"
    at MessageError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:721:66)
    at new MessageError (/usr/lib/node_modules/yarn/lib/cli.js:750:123)
    at Extract.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:62682:14)
    at Extract.emit (events.js:198:15)
    at Extract.module.exports.Extract.destroy (/usr/lib/node_modules/yarn/lib/cli.js:139624:17)
    at onunlock (/usr/lib/node_modules/yarn/lib/cli.js:139501:26)
    at /usr/lib/node_modules/yarn/lib/cli.js:45391:25
    at /usr/lib/node_modules/yarn/lib/cli.js:45357:23
    at /usr/lib/node_modules/yarn/lib/cli.js:62632:13
    at FSReqCallback.oncomplete (fs.js:158:21)
error https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz: Extracting tar content of "/home/adys/.cache/yarn/v4/npm-fast-json-stable-stringify-2.0.0-d5142c0caee6b1189f87d3a76111064f86c8bbf2/node_modules/fast-json-stable-stringify/.yarn-tarball.tgz" failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/home/adys/.cache/yarn/v4/npm-fast-json-stable-stringify-2.0.0-d5142c0caee6b1189f87d3a76111064f86c8bbf2/node_modules/fast-json-stable-stringify/test/to-json.js'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Full log: verbose.txt.gz

@melaku-z
Copy link

related to #6312

  • Upgrade to 1.13+

@jleclanche
Copy link
Author

This is on 1.15.2.

@melaku-z
Copy link

This is on 1.15.2.

Yes, my bad. "yarn install --network-concurrency 1" is working for me, a temporary, slow workaround.

@ue360
Copy link

ue360 commented May 14, 2019

I used the 1.7 version before today, it never happened, and today I upgraded to the latest version (1.15.2), it will happen: Extracting tar content of undefined failed, the file appears to be corrupt

@TikiTDO
Copy link

TikiTDO commented May 19, 2019

I was seeing this fairly consistently on 1.16.0, and was finally able to track this down.

Our setup is as follows:

  1. A /package.json which defines a bunch of workspaces
  2. A /workspace/package.json which references a git modules
  3. A custom build of a node module in git, with a package.json with a scripts -> prepare key.

This was causing an extra instance of yarn to run that script, which then tried to fetch packages needed by this lib outside of the expected order. Since the lib in question is mostly dead, and barely needed in our case I was able to resolve the problem by removing the prepare script.

For everyone else having these problems I recommend removing any git packages you have referenced, and failing that to grep all the package.json files in your project for these reserved scripts since they may be the cause. This is almost certainly the case if you see this sort of duplication:

[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...

Hope this helps root cause this in a more reliable fashion.

@TikiTDO
Copy link

TikiTDO commented May 19, 2019

@arcanis You mentioned in #6312 that it was closed because there was no further details. I believe my post above this one may explain what's happening here. It look like (as an educated guess) that the instance of yarn being called to service the special scripts like install, postinstall, prepublish, and prepare is not respecting any sort of mutex config.

MoOx added a commit to rescript-react-native/rescript-react-native that referenced this issue Jun 6, 2019
MoOx added a commit to rescript-react-native/rescript-react-native that referenced this issue Jun 6, 2019
* try thing

* Delete yarn.lock

* bump react-multiversal to avoid yarn bug yarnpkg/yarn#7212

* back trick
@foodforarabbit
Copy link

I was seeing this fairly consistently on 1.16.0, and was finally able to track this down.

Our setup is as follows:

  1. A /package.json which defines a bunch of workspaces
  2. A /workspace/package.json which references a git modules
  3. A custom build of a node module in git, with a package.json with a scripts -> prepare key.

This was causing an extra instance of yarn to run that script, which then tried to fetch packages needed by this lib outside of the expected order. Since the lib in question is mostly dead, and barely needed in our case I was able to resolve the problem by removing the prepare script.

For everyone else having these problems I recommend removing any git packages you have referenced, and failing that to grep all the package.json files in your project for these reserved scripts since they may be the cause. This is almost certainly the case if you see this sort of duplication:

[1/4] Resolving packages...
[2/4] Fetching packages...
[1/4] Resolving packages...
[2/4] Fetching packages...

Hope this helps root cause this in a more reliable fashion.

THANK YOU! I had recently added .yarnrc with --install.mutex network to fix another issue (multiple simultaneous yarn in different repo on the same build server) and having this similar-but-shouldn't-be-possible-anymore error popped up really freaked me out. I noticed the repeated [1/4]... stuff though and turns out packages recursively calling yarn was indeed the problem!

I started by piping yarn into a file e.g. yarn --verbose 2>&1 | tee yarn-output and looking for clues around the area where I saw [1/4] repeat itself:

verbose 34.141 Performing "GET" request to "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.7.tgz".
verbose 34.15 Performing "GET" request to "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz".
verbose 34.592 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/e237f3006359452a9561519898e180fb.5025ebf2427d709adfb10ee07f7dc36517d03694.prepare/.npmrc".
verbose 34.592 Checking for configuration file "/Users/xxxxx/.npmrc".
verbose 34.592 Checking for configuration file "/Users/xxxxx/.nvm/versions/node/v10.15.0/etc/npmrc".
verbose 34.592 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/e237f3006359452a9561519898e180fb.5025ebf2427d709adfb10ee07f7dc36517d03694.prepare/.npmrc".
verbose 34.592 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/.npmrc".
verbose 34.592 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.npmrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/.npmrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/Library/Caches/.npmrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/Library/.npmrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/.npmrc".
verbose 34.593 Checking for configuration file "/Users/.npmrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/e237f3006359452a9561519898e180fb.5025ebf2427d709adfb10ee07f7dc36517d03694.prepare/.yarnrc".
verbose 34.593 Checking for configuration file "/Users/xxxxx/.yarnrc".
verbose 34.593 Found configuration file "/Users/xxxxx/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/.nvm/versions/node/v10.15.0/etc/yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/e237f3006359452a9561519898e180fb.5025ebf2427d709adfb10ee07f7dc36517d03694.prepare/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.tmp/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/v4/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/Caches/Yarn/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/Caches/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/Library/.yarnrc".
verbose 34.594 Checking for configuration file "/Users/xxxxx/.yarnrc".
verbose 34.595 Found configuration file "/Users/xxxxx/.yarnrc".
verbose 34.595 Checking for configuration file "/Users/.yarnrc".
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
verbose 34.869 Performing "GET" request to "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz".
verbose 34.87 Performing "GET" request to "https://registry.yarnpkg.com/css-box-model/-/css-box-model-1.0.0.tgz".

luckily, I decided to check out /Users/xxxxx/Library/Caches/Yarn/v4/.tmp/e237f3006359452a9561519898e180fb.5025ebf2427d709adfb10ee07f7dc36517d03694.prepare/.yarnrc and that folder was still around - checked out the package.json and realized that it was a library that I had forked and included as my dependancy recently. I'm guessing that the prepare script isn't called when the package is included "naturally" through npm, but it is when it is included as a github repo. For the record, the package I forked was react-beautiful-dnd. Once I updated my fork to remove the prepare script, the phantom pipeline issues stopped appearing. THANK YOU!

@Yaxian
Copy link

Yaxian commented Jun 27, 2019

try this way in your Dockerfile:

RUN mkdir .yarncache
RUN yarn install --cache-folder ./.yarncache
RUN rm -rf .yarncache

or in your workspace:

mkdir .yarncache
yarn install --cache-folder ./.yarncache
rm -rf .yarncache

@esutton
Copy link

esutton commented Jul 2, 2019

  • Seeing this on my CI machine but not my dev machine with yarn 1.16.0
  • I have seen problem with both yarn 1.16.0 and 1.17.0

#6312 suggested adding '--network-concurrency 1' which ** seems ** to work.

# https://github.com/yarnpkg/yarn/issues/6312
# Added '--network-concurrency 1'
# 
# Example Error: 
# error confusing-browser-globals-1.0.7.tgz: 
# Integrity check failed for "confusing-browser-globals" (computed integrity doesn't match our records

yarn install --network-concurrency 1

@TikiTDO
Copy link

TikiTDO commented Jul 2, 2019

@esutton Check my first comment in this thread here. You can probably get away without having to use the network-concurrency key if you find the offending lib.

@bitsal

This comment has been minimized.

@esutton

This comment has been minimized.

@bitsal
Copy link

bitsal commented Jul 4, 2019

@esutton yarn install --network-concurrency 1 doesn't fully help me
I still have errors like this:

yarn install v1.16.0

[1/4] Resolving packages...

[2/4] Fetching packages...

error An unexpected error occurred: "ENOENT: no such file or directory, open '.../.cache/yarn/v4/npm-spdx-exceptions-2.2.0-2ea450aee74f2a89bfb94519c07fcd6f41322977/node_modules/spdx-exceptions/.yarn-metadata.json'".

info If you think this is a bug, please open a bug report with the information provided in ".../yarn-error.log".

info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

script returned exit code 1

@FezVrasta
Copy link

FezVrasta commented Jul 31, 2019

#7212 (comment)

I can confirm the issue seems to be related to a git dependency. But a workspace is not needed in my case to repro the problem.

Also, in my case it happens on a Docker node:12.7-alpine (I tried even with 11.x) image, but on on a a standard [email protected] travis worker.

@cinderblock
Copy link

I think this is a dupe of #2629

@FezVrasta
Copy link

It looks different to me 🤔

@TikiTDO
Copy link

TikiTDO commented Aug 14, 2019

The --ignore-scripts suggestion may be relevant to the issue at hand, though it honestly looks like that issue is really a few problems rolled into one discussion

@dgobaud
Copy link

dgobaud commented Aug 20, 2019

Update found a workaround that does work.... a git submodule and then have the location of the package be the local folder. Not ideal but it works.

Think we're having this problem too details here #2629 (comment) seems related to having a dependency hosted on github.com

cdrini added a commit to cdrini/bookreader that referenced this issue Sep 19, 2019
We're experiencing what looks like
yarnpkg/yarn#7212 when we try to install
the bookreader repo through yarn. It says the prepare step on a
git:// referenced dependency (which is what we use) might be causing
this error (although this error doesn't happen at all when run on
@jbuckner's machine with that exact setup :/). Trying the `preinstall`
hook to see if that fixes things.
cdrini added a commit to cdrini/bookreader that referenced this issue Sep 19, 2019
Prepare was causing us to get this issue:
yarnpkg/yarn#7212 . preinstall is run
before install but not before a publish; since we don't publish
this package on npm anyways, this is fine.
cdrini added a commit to internetarchive/bookreader that referenced this issue Sep 24, 2019
Prepare was causing us to get this issue:
yarnpkg/yarn#7212 . preinstall is run
before install but not before a publish; since we don't publish
this package on npm anyways, this is fine.
iltempo added a commit to iltempo/jsdom that referenced this issue Sep 26, 2019
Prepare is causing random failures when installing dependencies via yarn on ZEIT.  Use preinstall instead.
yarnpkg/yarn#7212 (comment)
chetstone added a commit to chetstone/react-native-device-info that referenced this issue Nov 6, 2019
@Dan-Wood
Copy link

Dan-Wood commented May 24, 2022

If anyone is experiencing this still, as we were on bitbucket.

We have two private repos that are imported into our main one, each of these repos have a prepare script that runs husky install.

The prepare script has been changed to the below
"prepare": "node ./ci-skip-husky.js || husky install",

And the script ci-skip-husky.js

if (process.env.CI) {
	process.exit(0);
} else {
	process.exit(1);
}

A .yarnrc file with the current options set

network-concurrency 1

child-concurrency 1

mutex network

child-concurrency being the main one.

This has fixed our issues on node 16.15.0, yarn 1.22.18

@jjeising
Copy link

jjeising commented Jun 12, 2022

child-concurrency being the main one.

Note: these options were removed in yarn v2.

@Dan-Wood
Copy link

child-concurrency being the main one.

Note: these options were removed in yarn v2.

Original issue is using Yarn 1 not 2, still relevant.

brandonulyons added a commit to brandonulyons/subtracks that referenced this issue Jun 24, 2022
* run validation before yarn license

* attempt to fix CI errors

yarnpkg/yarn#7212
@realtebo
Copy link

realtebo commented Jul 1, 2022

same problem appearing on a very fast fiber connection. why should be a problem of network concurrency?

@cinderblock
Copy link

cinderblock commented Jul 2, 2022

This isn't caused by network issues. It's because multiple dependency trees overlap and Yarn doesn't do a great job of preventing a shared dependency with a build step from being built concurrently. It's a race condition that is apparently difficult to debug won't be fixed because Yarn 1 is no longer supported. See the next comment for a fix.

@markjm
Copy link

markjm commented Jul 2, 2022

I don't think the debugging of the issue is the problem, its simply that yarn 1 is out of support. Seems there are 3 options:

  1. upgrade to yarn 3
  2. use this fork of yarn@1 which fixes the issue (and has other performance improvements) https://github.com/VincentBailly/yarn
  3. Use your own fork of yarn, and apply this patch to it https://patch-diff.githubusercontent.com/raw/yarnpkg/yarn/pull/8182.patch

@realtebo
Copy link

realtebo commented Jul 6, 2022

We are using yarn 3, Same problem

@cengit
Copy link

cengit commented Sep 30, 2022

in the pipeline yarn install --network-concurrency 1 works very good for me
code snippet:

rm -rf ./yarn.lock
yarn install --network-concurrency 1

pradithya referenced this issue in caraml-dev/merlin Oct 3, 2022
* Update lazy-log package

* Refactor stream logs API

* Introducing ContainerLogsView component

* Support logging for pyfunc image builder and batch job

* Fix batch job's image builder log. Support prefixing log with pod & container name

* Add batch job executor log

* Dockerfile: Add git so we Yarn installation can succeed

* Use node:14 as node-builder base image

* Colorized the pod + container in log

* Use actions/setup-node@v2 and node v14

* Update react-lazylog package to use gojekfarm to sovle yarn install issue

https://github.com/yarnpkg/yarn/issues/7212\#issuecomment-493720324

* We still need react-lazylog's prepare script.

so we revert to roman's react-lazylog version and use yarn install --network-concurrency 1

* Refactor stackdriver log

* Fix API's unit test first

* Add more test to cluster and log_service

* Fix UI wording

* Update swagger

* Make sure color lib turned on

* Add build-essential and etc isntallation on Mlflows' Dockerfile

* Update API test

* Use gojekfarm's react-lazylog fork

* Update how to close channel; getContainerLogs async

* Use request.Context() for termintation

* Fix API test

* Modularize pprof routes into a spearate function

* Address aria's review

* Use unbuffered channel for sending log line

* Periodically update component list and address reviews

* Simplify component refresh & log api context cancellation
@ckxddd0324
Copy link

is there update for this?

@dmstoykov
Copy link

dmstoykov commented Oct 25, 2022

is there update for this?

Removing the prepare script to avoid the above-mentioned race condition fixed my issue. In my case I have no problem running the prepare contents manually.

hlerebours added a commit to DiliTrust/html-to-docx that referenced this issue Dec 13, 2022
there is a race condition in the prepare script that makes yarn
install fail randomy when fetching packages from clm-api

cf yarnpkg/yarn#7212
hlerebours added a commit to DiliTrust/html-to-docx that referenced this issue Dec 13, 2022
there is a race condition in the prepare script that makes yarn
install fail randomy when fetching packages from clm-api

cf yarnpkg/yarn#7212
@douglasjunior
Copy link

douglasjunior commented Dec 21, 2022

For us, --network-concurrency 1 is enough on local machines, but is not in pipelines.

Like @Dan-Wood, we use many private packages installed directly from git.

Intermittent errors are:

error [https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.5.tgz:](https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.5.tgz) Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/usr/local/share/.cache/yarn/v6/npm-es-abstract-1.20.5-e6dc99177be37cacda5988e692c3fa8b218e95d2-integrity/node_modules/es-abstract/2015/SecFromTime.js'"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

And

error An unexpected error occurred: "ENOENT: no such file or directory, open '/usr/local/share/.cache/yarn/v6/npm-omni-context-rn-0.0.1-a54c1dfa46bc463677451a88bf6ad83ad5ea6aaa/node_modules/my-private-library/.yarn-tarball.tgz'".
info If you think this is a bug, please open a bug report with the information provided in "/opt/atlassian/pipelines/agent/build/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@cinderblock
Copy link

I remember when Yarn was the new hotness. If you were still using Npm, everything took too long. Yarn was the only sane choice.

Then this happened. I dealt with it for a while with manual build scripts that manually installed dependencies from git sources in a temporary directory first - this seemed to reliably fix the problem but always felt kludgy. It was a bummer that Yarn has refused to fix the problem, or really even acknowledge that there is one, but at least I had a workaround and was happy enough to keep using Yarn.

Then Yarn 2 came crashing into the party with it's own headaches. Notably intentionally breaking compatibility with many Npm lifecycle scripts. As far as I can tell, there is now no way to have a "prepare" process that works consistently between Npm and Yarn - there is no way, that I'm aware of, to publish TypeScript sources such that when they're installed via git dependency, they consistently compile into the final desired JavaScript in both Yarn and Npm (without extra unreliable monkey patches in the build scripts).

We've had reliable repros here for years. How is this still a thing?

Is there a reason to keep using Yarn?

@arcanis
Copy link
Member

arcanis commented Dec 21, 2022

We've had reliable repros here for years. How is this still a thing?

You're two major versions behind, three if we count the current RCs for the next major.

We know the 1.x has a couple of rare but annoying bugs that are unfortunately quite hard to safely address (by safely, I mean without introducing other subtle bugs). This is in large part why, almost four years ago now, we decided to publish new majors that tackle this problem. While using Yarn 1.x is still possible, and if it works for you then you don't have to migrate just for the sake of it, it's nonetheless advised to upgrade if you're hitting frustrating issues like this one.

As for problems with modern releases, I encourage you to open issues on their dedicated tracker. I don't however remember hearing about problems similar to the ones you mention (the prepack script seems to do what you want, as described on its documentation page), so perhaps open a discussion first to be sure we're talking about the same thing.

In any case, I'll lock this thread as our team doesn't plan to merge bugfixes here. Understand that any change we make here has the potential to break many applications, so for the better or the worst we decided a long time ago to simply freeze the old 1.x codebase (only exceptions being potential security fixes, and migration-related improvements).

@yarnpkg yarnpkg locked as resolved and limited conversation to collaborators Dec 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet